package com.lrkj.smartservice.service.impl;

import com.lrkj.common.utils.DateUtils;
import com.lrkj.common.utils.uuid.IdUtils;
import com.lrkj.smartservice.domain.SlideData;
import com.lrkj.smartservice.mapper.SlideDataMapper;
import com.lrkj.smartservice.service.ISlideDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 轮播列分类Service业务层处理
 *
 * @author yajun_ren
 * @date 2021-04-02
 */
@Service
public class SlideDataServiceImpl implements ISlideDataService {
    @Autowired
    private SlideDataMapper slideDataMapper;

    /**
     * 查询轮播列分类
     *
     * @param slideDataId 轮播列分类ID
     * @return 轮播列分类
     */
    @Override
    public Object selectSlideDataById(String slideDataId) {
        return slideDataMapper.selectSlideDataById(slideDataId);
    }

    /**
     * 查询轮播列分类列表
     *
     * @param slideData 轮播列分类
     * @return 轮播列分类
     */
    @Override
    public List<SlideData> selectSlideDataList(SlideData slideData) {
        return slideDataMapper.selectSlideDataList(slideData);
    }

    /**
     * 新增轮播列分类
     *
     * @param slideData 轮播列分类
     * @return 结果
     */
    @Override
    public int insertSlideData(SlideData slideData) {
        slideData.setSlideDataId(IdUtils.simpleUUID());
        slideData.setCreateTime(DateUtils.getNowDate());
        return slideDataMapper.insertSlideData(slideData);
    }

    /**
     * 修改轮播列分类
     *
     * @param slideData 轮播列分类
     * @return 结果
     */
    @Override
    public int updateSlideData(SlideData slideData) {
        slideData.setUpdateTime(DateUtils.getNowDate());
        return slideDataMapper.updateSlideData(slideData);
    }

    /**
     * 批量删除轮播列分类
     *
     * @param slideDataIds 需要删除的轮播列分类ID
     * @return 结果
     */
    @Override
    public int deleteSlideDataByIds(String[] slideDataIds) {
        return slideDataMapper.deleteSlideDataByIds(slideDataIds);
    }

    /**
     * 删除轮播列分类信息
     *
     * @param slideDataId 轮播列分类ID
     * @return 结果
     */
    @Override
    public int deleteSlideDataById(String slideDataId) {
        return slideDataMapper.deleteSlideDataById(slideDataId);
    }

    @Override
    public List<SlideData> selectSlideDataByType(String slideType) {
        return slideDataMapper.selectSlideDataByType(slideType);
    }
}
